#include <iostream>
using namespace std;
int main()
{
  int cnt=0,flag=0,s=0;
  cin>>cnt;
  flag=cnt;
  while(flag>=3)
  {
    cnt+=flag/3;
    flag=flag%3+flag/3;
  }
  cout<<cnt;
}